Imports org.codegen.win.controls
Imports org.model.lib.db


Public Interface ICriterionMetadata

    Property Name() As String
    Property isRange() As Boolean

    Property isMandatory() As Boolean
    Property isMandatory2() As Boolean

    Property selectedvalue() As Object
    ''' <summary>
    ''' This is the "human" form of the selected value
    ''' </summary>
    Property selectedDisplayValue() As String


    Property selectedvalue2() As Object

    ''' <summary>
    ''' This is the "human" form of the selected value
    ''' </summary>
    Property selectedDisplayValue2() As String

    Property defaultValue() As String
    Property defaultValue2() As String

    Property labelText() As String
    Property labelText2() As String

    Property controlUIType As enumReportCriterionUIType

    ''' <summary>
    ''' gets/sets a boolean to indicate if the field is read only
    ''' </summary>
    ''' <remarks>if the field is read only, the user cannot enter values</remarks>
    Property isReadOnly() As Boolean

    ''' <summary>
    ''' gets/sets a boolean to indicate if "To" field in the range is read only
    ''' </summary>
    ''' <remarks>This property applies only if isrange = true</remarks>
    Property isReadOnly2() As Boolean

    Property comboBoxDataSource() As String

    ''' <summary>
    ''' The help text of this control
    ''' </summary>
    Property helpText() As String


    Property SqlExpression As String

    ''' <summary>
    ''' The name of the "To" field in the range
    ''' </summary>
    ''' <remarks>This property applies only if isrange = true</remarks>
    ReadOnly Property Name2() As String

    Property criterionHandler() As ICriterionUIHandler

    ''' <summary>
    ''' Class that builds an sql clause based on the value (or values, if IsRange = 1 )
    ''' of this criterion
    ''' </summary>
    Property criterionBuilder As ICriterionProcessor

    ''' <summary>
    ''' Gets/Sets a boolean to indicate if this field is hidden
    ''' </summary>
    Property isHidden As Boolean

    ''' <summary>
    ''' Gets/Sets the width of the control.  if this is not specified,
    ''' the width is 300 
    ''' </summary>
    Property width As Integer

    ''' <summary>
    ''' Transient fields are shown on the criteria form
    ''' but do not pass the value to a report field
    ''' </summary>
    Property isTransient() As Boolean

    ''' <summary>
    ''' The corresponding sql field name, will be used to build the sql statement
    ''' </summary>
    ''' <remarks>Default value is property Name</remarks>
    Property SqlFieldName As String

    ''' <summary>
    ''' Returns true if the criterion has value
    ''' </summary>
    Function hasValue() As Boolean

    ''' <summary>
    ''' Returns true if the criterion has value in the "To" field
    ''' </summary>
    Function hasValue2() As Boolean

    Function getUIControl() As Control

    Function getValue(ByVal c As Control) As Object

    ''' <summary>
    ''' The display value is the human readable form of the selected / entered 
    ''' value in the control.
    ''' </summary>
    ''' <returns>String</returns>
    ''' <remarks>
    ''' For combo boxes, the "DisplayValue" is the text of the combo box.
    ''' For Date/ Datetime, it is the Date object formatted as string.
    ''' </remarks>
    Function getDisplayValue(ByVal c As Control) As String

    ''' <summary>
    ''' DEfault value is AND, Supported are: 
    ''' AND, LIKE
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Property SqlOperator() As String

End Interface
